﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">
  
    <div class="panel panel-default x-panel x-panel-layout">
    
      <div class="panel-heading">
        <ol class="breadcrumb clearfix">
          <li><a href="${ctx.host}/system">系统管理</a></li>
          <li class="active">员工管理</li>
          <li class="no-before pull-right" style="min-width: 65px;">
            <a onclick="window.history.back();"><i class="glyphicon glyphicon-arrow-left"></i>&nbsp;&nbsp;返回</a>
          </li>
        </ol>
      </div>
      
      <div class="panel-body">
      
        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>
        
        <div class="col-xs-10 x-panel-layout-right">
          
          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire" title="员工详情"></i>&nbsp;&nbsp;<span>员工管理&nbsp;-&nbsp;员工详情</span></h2>
            </div>
          </div>
          
          <div class="x-breadcrumb-wrapper" style="margin-top:20px;">
          
            <div class="x-breadcrumb yellow clearfix">
              <h2>
                <span>基本信息</span>
              </h2>
            </div>
            <c:if test="${!currentPrincipal.areaServer}">
              <a href="${ctx.host}/principals/${principal.id}/edit" data-toggle="modal" data-target="#edit-principal" style="position: absolute; right: 0px; top: 0px; margin-top: 10px; margin-right: 10px;">编辑账户</a>
            </c:if>
          </div> 
          
          <div class="form-horizontal" style="margin-bottom:20px;">
            
            <div class="form-group">
              <label class="col-xs-2 control-label">手机号码：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${principal.mobile}</p></div>
              <label class="col-xs-2 control-label">姓名：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${principal.name}</div>
            </div>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">用户角色：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${secure.roles[principal.authority].description}</div>
              
              <c:if test="${principal.areaManager or principal.areaServer}">
                <label class="col-xs-2 control-label">管理门店：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static">
                    <c:forEach var="site" items="${sites}" varStatus="varStatus">
                      ${varStatus.index eq 0 ? '' : ','}${site.name}
                    </c:forEach>
                  </p>
                </div>
              </c:if>
              <c:if test="${principal.siteManager || principal.siteServer}">
                <label class="col-xs-2 control-label">所属门店：</label>
                <div class="col-xs-4 pull-left">
                  <p class="form-control-static">${site.name}</p>
                </div>
              </c:if>
              
            </div>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">后台登录权限：</label>
              <div class="col-xs-4 pull-left">
                <p class="form-control-static text-success"><span class="label label-${principal.admin ? 'success' : 'default'}">${principal.admin ? '是' : '否'}</span></p>
              </div>
              <label class="col-xs-2 control-label">企业号登录权限：</label>
              <div class="col-xs-4 pull-left">
                <p class="form-control-static text-success"><span class="label label-${principal.enterprise ? 'success' : 'default'}">${principal.enterprise ? '是' : '否'}</span></p>
              </div>
            </div>
          </div>
          
          <c:if test="${principal.isCoach()}">
            <div class="x-breadcrumb-wrapper" style="margin-top:20px;">
              <div class="x-breadcrumb yellow clearfix">
                <h2>
                  <span>可预约时间</span>
                </h2>
              </div>
            </div>
            
            <table class="table table-striped table-hover x-table" style="margin-bottom:20px;">
              <thead>
                <tr>
                  <th width="40%">店长</th>
                  <th width="20%">可预约时间</th>
                  <!-- <th width="20%">可预约小时</th> -->
                  <th width="20%">操作</th>
                </tr>
              </thead>
              <tbody>
                <c:forEach var="relation" items="${relations}">
                  <tr>
                    <td>${relation.manager.name}</td>
                    <td>${relation.appointTime}</td>
                    <!-- <td>${relation.appointManyHour}</td> -->
                    <td>
                      <c:if test="${!currentPrincipal.areaServer}">
                        <a href="${ctx.host}/principals/${principal.id}/edit-appoint-days/${relation.manager.id}" data-toggle="modal" data-target="#edit-appoint-days">修改</a>
                      </c:if>
                    </td>
                  </tr>
                </c:forEach>
              </tbody>
            </table>
          </c:if>
          
          <div class="x-breadcrumb-wrapper" style="margin-top:20px;">
            <div class="x-breadcrumb yellow clearfix">
              <h2>
                <span>个人信息</span>
              </h2>
            </div>
            <a href="${ctx.host}/principals/${principal.id}/profile" data-toggle="modal" data-target="#principal-profile-edit" style="position: absolute; right: 0px; top: 0px; margin-top: 10px; margin-right: 10px;">编辑个人信息</a>
            <a href="${ctx.host}/principals/${principal.id}/avatar" data-toggle="modal" data-target="#principal-avatar-edit" style="position: absolute; right: 100px; top: 0px; margin-top: 10px; margin-right: 10px;">上传头像</a>
            <a href="${ctx.host}/principals/${principal.id}/special-tags" data-toggle="modal" data-target="#principal-avatar-edit" style="position: absolute; right: 170px; top: 0px; margin-top: 10px; margin-right: 10px;">编辑特色标签</a>
          </div>
          
          <div class="form-horizontal" style="margin-bottom:20px;">
          
            <div class="form-group">
              <label class="col-xs-2 control-label">真实姓名：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${principal.profile.realname}</p></div>
              <label class="col-xs-2 control-label">昵称：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${principal.profile.nickname}</div>
            </div>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">性别：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${principal.profile.gender.description}</p></div>
              <label class="col-xs-2 control-label">个人描述：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${principal.profile.description}</div>
            </div>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">头像：</label>
              <div class="col-xs-4 pull-left">
                <c:choose>
                  <c:when test="${empty principal.profile.avatar}">
                    <p class="form-control-static">暂无头像，请上传</p>
                  </c:when>
                  <c:otherwise>
                    <img src="${cloud.prod}/${principal.profile.avatar}-qrcode">
                  </c:otherwise>
                </c:choose>
              </div>
              <label class="col-xs-2 control-label">擅长：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${principal.profile.specialty}</div>
            </div>
            <div class="form-group">
              <label class="col-xs-2 control-label">特色课标签：</label>
              <div class="col-xs-8 pull-left">
                 <p class="form-control-static">
                 <c:forEach var="tag" items="${principal.profile.tags}">
                  <label for="" class="label label-success">${tag.desc}</label>&nbsp;
                </c:forEach>
                 </p>
              </div>
            </div>
          
          </div>
          
           <c:if test="${principal.isCoach()}">
            <div class="x-breadcrumb-wrapper" style="margin-top:20px;">
              <div class="x-breadcrumb yellow clearfix">
                <h2>
                  <span>课时记录</span>
                </h2>
              </div>
            </div>
            
            <div id="grid-wrap" style="min-height: 490px;">
            </div>
            
          </c:if> 
          
        </div>
      </div>
    </div>
  </div>
  
  <%@ include file="/WEB-INF/include/footer.jsp"%>
  <%@ include file="/WEB-INF/include/script.jsp"%>
  
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/system/principal/principal-view.js">
    <script type="text/javascript">
      require(['page/system/principal/principal-view'] , function(page) {
        page.init({
        	'principalId': '${principal.id}'
        });
      })
    </script>
  </d:resource>

</body>

</html>